﻿@{
    ViewBag.Title = "菜肴选择";
    Layout = "~/Views/Shared/_LayoutList.cshtml"; 
}
@(       
 Html.nbGridFor<Dish>(s =>
 {
     s.ID("gridList");
     s.Action(@Url.Action("MultipleDishList"));
     s.Height("document.documentElement.clientHeight-86");
     s.Columns(col =>
     {
         col.BindEnum(e => e.MainMaterialType, "MaterialCategory");
         col.BindEnum(e => e.Category, "DishType");
         col.Bind(e => e.Id).IsKey();
         col.Bind(e => e.Code).Width(60).AsQuery().Align(GridAlign.Left);
         col.Bind(e => e.Name).Width(80).AsQuery().Align(GridAlign.Left);
         col.Bind(e => e.Cost).Width(80).Align(GridAlign.Right);
     });
     s.Buttons(btn =>
     {
         btn.Bind("选择", GridButtonType.Add).OnClick("Selected");
     });
 }))
<script type="text/javascript">
    function Selected() {
        if ($("#gridList").getSelectedRows().length == 0) {
            alert("请选择一条记录");
        }
        var date = $("#gridList").getSelectedRows();
        CloseModalDialog(null, true, date);
    }
</script>
